UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e1cPif7NJZlg1qoUUpmbcim9761rT/hsFsQoV+66zik=' 
WHERE 
  key_id = '77b86e9d3fe5909be0c33b58bf0f5c978b5dc8e279ea3a89512dc30e534195cf' 
  AND (
    token = 'e1cPif7NJZlg1qoUUpmbcim9761rT/hsFsQoV+66zik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044