UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JJ6MXcYXBV12yyG79eYdcM0MOlT7HdDUfEHRQUlDgGo=' 
WHERE 
  key_id = 'bc6a3b38425a80d30542fd4a1834f37cbeb6310ba59291a78f40215e2734e678' 
  AND (
    token = 'JJ6MXcYXBV12yyG79eYdcM0MOlT7HdDUfEHRQUlDgGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053