UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'StTf0jC5cvnproRblfu5Fq9PUK1XwnbvbTq2INPfplw=' 
WHERE 
  key_id = '4e1f27c1c75ac93885a863d5f8e7f92d17585f57e999f89a166ea8a027b9f822' 
  AND (
    token = 'StTf0jC5cvnproRblfu5Fq9PUK1XwnbvbTq2INPfplw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031