UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SUOmlJdtGwR+FeFdH6pTO9cvqerOdFUf7jdBKxmer50=' 
WHERE 
  key_id = 'bc209391b708c7c30ecbca9cc7d84437146af42de949b79abeb034d31754f8f1' 
  AND (
    token = 'SUOmlJdtGwR+FeFdH6pTO9cvqerOdFUf7jdBKxmer50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046