UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XgYRChJwxA4aPeCA5ZwWr+tmNPa6G9b4cgte+xs0iqQ=' 
WHERE 
  key_id = '995e5ca22f60d1d0cec470b112a808bbb5117278a9df74f21004e01c78cf5b8e' 
  AND (
    token = 'XgYRChJwxA4aPeCA5ZwWr+tmNPa6G9b4cgte+xs0iqQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051