UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B24w+EwlVXIz9+AAoBGO49F1/n7fV2WKnv8PxZKamks=' 
WHERE 
  key_id = 'cd843d89fd7175e65280848cb0af3a423b7cb890252ba87169695593f53bdc29' 
  AND (
    token = 'B24w+EwlVXIz9+AAoBGO49F1/n7fV2WKnv8PxZKamks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027