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

Query time 0.00034