UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NJJnWjdYU5MxY7uheVPIpVEySmbbsyez2muuc/ZSDJI=' 
WHERE 
  key_id = '40df0c865fd1bb1c57f42eb3b984a87f4a9953e7ee6f5161ade7f5a812fb98ab' 
  AND (
    token = 'NJJnWjdYU5MxY7uheVPIpVEySmbbsyez2muuc/ZSDJI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052