UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wR9b7y5Dducx9uUnz+4W2UPOmxXCdXXlzuB1BI4bx5c=' 
WHERE 
  key_id = 'f6b118ce8089cc20151ab0c734e7b31108bce67af2513f8d53f6570a530ae985' 
  AND (
    token = 'wR9b7y5Dducx9uUnz+4W2UPOmxXCdXXlzuB1BI4bx5c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034