UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6B8xoNA+w+dosweq8RpSOlppON7kaqAwkWVtIY3F4+w=' 
WHERE 
  key_id = 'b5945744378754c1b8e082a474a48f5011408998edb6a437abdef86ee954b244' 
  AND (
    token = '6B8xoNA+w+dosweq8RpSOlppON7kaqAwkWVtIY3F4+w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040