UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e46IniNZLChliuzhHSAjlTH8PzZ2i5UGgiI+eQDyelk=' 
WHERE 
  key_id = '5b116938a976b60d7ecfdbbcae39d2230e7e7a4f23421b12e078d21f3a8fbec1' 
  AND (
    token = 'e46IniNZLChliuzhHSAjlTH8PzZ2i5UGgiI+eQDyelk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049