UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xNEHcwy3WE6LTncs7tMGGAdJabEQz85d6a9zryFcKDk=' 
WHERE 
  key_id = '6e0f6369e544f67d54a410d15f0930fff4994cfa57b0939cfd8856a5232b7594' 
  AND (
    token = 'xNEHcwy3WE6LTncs7tMGGAdJabEQz85d6a9zryFcKDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026