UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OsMgn8zdQYdFWAy8cygXS7PS3uZrL5gNeUbPBRCSzt4=' 
WHERE 
  key_id = '576ac76c06ef7463f07db0f45ebadf9c0eddd110965c93752249b0172fa3798b' 
  AND (
    token = 'OsMgn8zdQYdFWAy8cygXS7PS3uZrL5gNeUbPBRCSzt4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047