UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7cNP2HMmud53fwEts5cXBjCOC+Wo2mtpG19pwFpBhq4=' 
WHERE 
  key_id = 'bd732654ff6ba9c8faa97068e45416a78630b20169742c6434f800e8dda20cf9' 
  AND (
    token = '7cNP2HMmud53fwEts5cXBjCOC+Wo2mtpG19pwFpBhq4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046