UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1S2gyOe44SVt8EpgqWIp0w9/LZe7+Srow/weErCurw0=' 
WHERE 
  key_id = 'd856bc6f6620a36a33823645e0eeb799a3f233c501475a47d7fb577fdc9b11b8' 
  AND (
    token = '1S2gyOe44SVt8EpgqWIp0w9/LZe7+Srow/weErCurw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044