UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bfbL5b4jItGCwofSko1SChSgqaHCY2z4PLhZtEQduFU=' 
WHERE 
  key_id = '28fd72c3f23f802f0089e15b8d0ab3ac400d7d288783799d561a8d4b6973fc10' 
  AND (
    token = 'bfbL5b4jItGCwofSko1SChSgqaHCY2z4PLhZtEQduFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00074