UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yndlpfRi3zuFDItLDpKWZ1J6QgOvuo/+MpGPwx9bcjQ=' 
WHERE 
  key_id = '339763191dd9f28ae0cf9c3803ea25b140ddcb29b5640db5e017d67161915890' 
  AND (
    token = 'yndlpfRi3zuFDItLDpKWZ1J6QgOvuo/+MpGPwx9bcjQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045