UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ivPTJpek4vNQK2CRlrFmvPxQVXfZtYCkzIqhXvwtSdg=' 
WHERE 
  key_id = '108c94272c4c6732015697e433140aa38055f489bbce3cd76b90309d38c91424' 
  AND (
    token = 'ivPTJpek4vNQK2CRlrFmvPxQVXfZtYCkzIqhXvwtSdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059