UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ev1trMWlhLuZPbTWBOp44oer5JfF5YYxXnW58qgFqwc=' 
WHERE 
  key_id = 'f09efa70abcf6a2375d90cd7327676415f487757ef54907fb2611cdc3cdb3c24' 
  AND (
    token = 'Ev1trMWlhLuZPbTWBOp44oer5JfF5YYxXnW58qgFqwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045