UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IzqXjyf8NkSYaYY07Lfxvcioc3l3d3vcgDFfWaxxuUo=' 
WHERE 
  key_id = '84f8a88cd2d512de799c96318aa89a0383c94a2a9ec8ad094f8d8c4d4ea29c54' 
  AND (
    token = 'IzqXjyf8NkSYaYY07Lfxvcioc3l3d3vcgDFfWaxxuUo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026