UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K41hXoXxxcX1/I/tye+THLVudiNkS9gCsUvhB2/pojI=' 
WHERE 
  key_id = '7389ba5eac0da4713b429eacab37e4317f8fb09c3044706d1894542f90c1f551' 
  AND (
    token = 'K41hXoXxxcX1/I/tye+THLVudiNkS9gCsUvhB2/pojI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038