UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kRor5sk99jQystM+gNsxzcvOrNQSWLd93kkNE16O9y0=' 
WHERE 
  key_id = 'b1e790bc153ff60d284e82829babb976df8c8a15a6c841709935ef1321d7d6e0' 
  AND (
    token = 'kRor5sk99jQystM+gNsxzcvOrNQSWLd93kkNE16O9y0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028